<%--
  Created by IntelliJ IDEA.
  User: 11875
  Date: 2021/10/18
  Time: 10:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>班级列表</title>
    <link rel="stylesheet" href="/css/homepageheder.css">
    <link rel="stylesheet" href="/css/tradmilsit.css">
    <link rel="stylesheet" href="/css/classlist.css">
    <link rel="stylesheet" href="/css/bootstrap.css">
    <link rel="stylesheet" href="/css/homepage.css">
</head>
<body>
<div class="heder">
    <div class="title">
        <div class="title_t">
            <span>宿 舍 管 理 系 统</span>
        </div>
        <div class="title_r">
            欢迎您！！！
            <c:if test="${user.typeid == 1}">
                班主任老师
            </c:if>
            <c:if test="${user.typeid == 2}">
                班主任老师
            </c:if>
            ${user.uname}
            <span>|</span>
            <a href="javascript:history.go(-1)">返回上一页</a>
            <span>|</span>
            <a href="/user/main">返回主页</a>
            <span>|</span>
            <a href="/user/updatepasswordpage">修改密码</a>
            <span>|</span>
            <a href="/user/logout">退出</a>
        </div>
    </div>
</div>

<!-- 列表 -->
<div id="table">
    <div class="table_title clearfix">
        <h2>班 级 列 表</h2>

        <div class="table_search">
            <form action="/classes/classesbyname" class="form-inline my-2 my-lg-0">
                <input class="form-control mr-sm-2" type="search" placeholder="输入班级名称" aria-label="Search"
                       name="classesname">
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
            </form>
        </div>
    </div>
    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th scope="col">班级名称</th>
            <th scope="col">所属年级</th>
            <th scope="col">开班时间</th>
            <th scope="col">当前状态</th>
            <th scope="col">班级人数</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:if test="${classesPage.datalist.size()==0}">
            <tr>
                <td colspan="6">没有管理的班级</td>
            </tr>
        </c:if>
        <c:forEach items="${classesPage.datalist }" var="classes">
            <tr>
                <th scope="row">${classes.cname}</th>
                <td>${classes.cgrade}级</td>
                <td><fmt:formatDate value="${classes.cdate}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                <td>${classes.cstatus==1?"在读":"毕业"}</td>
                    <%--                <td><a href="/student/studentsbyclass?cid=${classes.cid}" title="查看当前班级学生">${classes.studentsnum}</a></td>--%>
                <td><a href="/student/studentsbyclass/${classes.cid}.html" title="查看当前班级学生">${classes.studentsnum}</a>
                </td>
                <td>
                    <a href="./classesdetaibyid.html" class="btn btn-info"><i class="bi bi-info-circle"></i>详情</a>
                    <c:if test="${classes.cstatus == 1}">
                        <a href="./updateclassesbyid.html" class="btn btn-danger"><i
                                class="bi bi-layout-text-sidebar"></i>修改</a>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>


<div class="clearfix addclass">
    <button type="button" class="btn btn-primary">
        <a href="/classes/addclassespage">点击添加新的班级</a>
    </button>
</div>


<!-- 分页 -->
<nav aria-label="Page navigation example" id="paging">
    <ul class="pagination justify-content-center pagination-lg">
        <c:if test="${classesPage.curpage>1}">
            <li class="page-item">
                <a class="page-link" href="/classes/classeslistbyteacher/${classesPage.curpage-1}/3.html"
                   aria-label="Previous">
                    <span aria-hidden="true">上一页</span>
                    <span class="sr-only">Previous</span>
                </a>
            </li>
        </c:if>
        <c:forEach begin="1" end="${classesPage.maxpage}" step="1" var="num">
            <c:if test="${classesPage.curpage==num}">
                <li class="page-item active"><a class="page-link" href="#" onclick="return false">${num}</a></li>
            </c:if>
            <c:if test="${classesPage.curpage!=num}">
                <li class="page-item"><a class="page-link" href="/classes/classeslistbyteacher/${num}/3.html">${num}</a>
                </li>
            </c:if>
        </c:forEach>
        <c:if test="${classesPage.curpage<classesPage.maxpage}">
            <li class="page-item">
                <a class="page-link" href="/classes/classeslistbyteacher/${classesPage.curpage+1}/3.html"
                   aria-label="Next">
                    <span aria-hidden="true">下一页</span>
                    <span class="sr-only">Next</span>
                </a>
            </li>
        </c:if>
    </ul>
</nav>

<script src="/js/jquery-3.6.0.min.js"></script>
<script src="/js/bootstrap.js"></script>
</body>
</html>
